package cn.mallss.api.dao;

import cn.mallss.beans.User;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.awt.print.Pageable;
import java.util.List;

public interface UserDao extends BaseDao<User,Integer> {

    @Query(value = "select * from t_User b where b.name=?1", nativeQuery = true)
    List<User> findByName(String name);


    @Modifying
    @Transactional
    @Query(value = "update #{#entityName} b set b.name=:name where id in :ids")
    Integer updateName(List<Integer> ids,String name);

    @Query(value = "SELECT b FROM User b WHERE b.name=?1 and b.id=?2")
    public  List<User> search(String... args);


}
